import requests
from app.config import url
from app.config import ak


#获取各类信息数据
def getMap():
    print("Service中getMap函数开始调用")
    results = [
        {
            "message":"附近500米范围内行业信息"
        },
        {
            "餐饮业信息": 10,
            "零售信息": 5,
            "休闲和娱乐信息": 6,
            "教育培训信息": 4,
            "运动健身": 2,
            "生活服务信息": 3,
            "金融保险信息": 1,
            "健康服务信息": 4,
            "车务服务信息": 4,
            "奶茶信息": 4
        },
    ]
    return results




# def getMap():
#     print("Service中getMap函数开始调用")
#     results = [
#         {
#             "餐饮业信息": getCatering(),
            # "零售信息": getRetail(),
            # "休闲和娱乐信息": getRecreation(),
            # "教育培训信息": getEducation(),
            # "运动健身": getSports(),
            # "生活服务信息": getLife(),
            # "金融保险信息": getFinanceAndInsurance(),
            # "健康服务信息": getHealth(),
            # "车务服务信息": getVehicleService(),
            # "奶茶信息": getNaichaService()
    #     },
    # ]
    # return results

#获取餐饮信息
# def getCatering():
#     params = {
#         "query": "餐饮",#要获得的行业信息
#         "location": "31.607018,120.785067",#用户所在的位置
#         "radius": "500",#要查询的范围
#         "output": "json",#以json格式返回
#         "ak": ak,#百度密钥
#     }
#     print(requests.get(url=url, params=params).json())#返回json格式的数据
#     response =requests.get(url=url, params=params).json()
#     return len(response["results"])#返回该行业信息个数
#
# # 获取零售信息
# def getRetail():
#     params = {
#         "query": "零售",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response =requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取休闲和娱乐信息
# def getRecreation():
#     params = {
#         "query": "休闲和娱乐",
#         "location":"31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取教育培训信息
# def getEducation ():
#     params = {
#         "query": "教育培训",
#         "location":"31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     print(response)
#     return len(response["results"])
#
# #获取运动健身信息
# def getSports():
#     params = {
#         "query": "运动健身",
#         "location":"31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取生活服务信息
# def getLife():
#     params = {
#         "query": "生活服务",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取金融保险信息
# def getFinanceAndInsurance():
#     params = {
#         "query": "金融保险",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取健康服务信息
# def getHealth():
#     params = {
#         "query": "健康服务",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
# #获取车辆服务信息
# def getVehicleService():
#     params = {
#         "query": "车两服务",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])
#
#
# #获取奶茶服务信息
# def getNaichaService():
#     params = {
#         "query": "奶茶",
#         "location": "31.607018,120.785067",
#         "radius": "500",
#         "output": "json",
#         "ak": ak,
#     }
#     response = requests.get(url=url, params=params).json()
#     return len(response["results"])


















